using System;
using System.Collections.Generic;
using NHibernate.Search.Attributes;
using NHibernate.Search;

namespace Ic.Model
{
	#region Bandsman

	/// <summary>
	/// Bandsman object for NHibernate mapped table 'TB_Bandsman'.
	/// </summary>
	[Serializable]
	[TableInfo(TableName = "TB_Bandsman", PrimaryKey = "Id" , Columns="Id,UserId,MatchFactor,hasBandExpr,hasInstrument,Freetime,FirstTime,RegDate,UpdateDate,isApproved")]
	[Indexed(Index = "Bandsman")] 
	public class Bandsman
	{
		#region Member Variables
		
		protected int _id;
		protected double _matchFactor;
		protected bool _hasBandExpr;
		protected bool _hasInstrument;
		protected string _freetime;
		protected DateTime _firstTime;
		protected DateTime _regDate;
		protected DateTime _updateDate;
		protected bool _isApproved;
		protected BandUser _user;
		/*protected IList<BandMember> _bandsmanTBBandMembers;*/

		#endregion

		#region Constructors

		public Bandsman() { }

		public Bandsman( double matchFactor, bool hasBandExpr, bool hasInstrument, string freetime, DateTime firstTime, DateTime regDate, DateTime updateDate, bool isApproved, BandUser user )
		{
			this._matchFactor = matchFactor;
			this._hasBandExpr = hasBandExpr;
			this._hasInstrument = hasInstrument;
			this._freetime = freetime;
			this._firstTime = firstTime;
			this._regDate = regDate;
			this._updateDate = updateDate;
			this._isApproved = isApproved;
			this._user = user;
		}

		#endregion

		#region Public Properties

		[DocumentId]
		public virtual int Id
		{
			get {return _id;}
			set {_id = value;}
		}

		public virtual double MatchFactor
		{
			get { return _matchFactor; }
			set { _matchFactor = value; }
		}

		public virtual bool HasBandExpr
		{
			get { return _hasBandExpr; }
			set { _hasBandExpr = value; }
		}

		public virtual bool HasInstrument
		{
			get { return _hasInstrument; }
			set { _hasInstrument = value; }
		}

		[Field(Index.Tokenized, Store = Store.Yes)]
		public virtual string Freetime
		{
			get { return _freetime; }
			set
			{
				if ( value != null && value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for Freetime", value, value.ToString());
				_freetime = value;
			}
		}

		public virtual DateTime FirstTime
		{
			get { return _firstTime; }
			set { _firstTime = value; }
		}

		public virtual DateTime RegDate
		{
			get { return _regDate; }
			set { _regDate = value; }
		}

		public virtual DateTime UpdateDate
		{
			get { return _updateDate; }
			set { _updateDate = value; }
		}

		public virtual bool IsApproved
		{
			get { return _isApproved; }
			set { _isApproved = value; }
		}

		public virtual BandUser User
		{
			get { return _user; }
			set { _user = value; }
		}

		public virtual IList<BandMember> BandsmanTB_BandMembers
		{
			get;set;
			#region remove
			/*
			get
			{
				if (_bandsmanTBBandMembers==null)
				{
					_bandsmanTBBandMembers = new List<BandMember>();
				}
				return _bandsmanTBBandMembers;
			}
			set { _bandsmanTBBandMembers = value; }
			*/
			#endregion
		}

		

		#endregion
	}
	#endregion
}